
package ProOF.apl.problems.real.functions;

import ProOF.com.LinkerParameters;
import java.lang.Math;
/**
 *
 * @author Lucas
 */
public class RealFuncSIN extends aRealFunction{
	
	private double A = 2.5;
	private double B = 5;
	private double z = 30;
	
	@Override
	public void parameters(LinkerParameters link) throws Exception {

	}
	
	@Override
	public int dimension() {
		return 20;
	}
	
	@Override
	public double min( int i ) {
		return 0;
	}
	
	@Override
	public double max( int i ) {
		return 180;
	}

	@Override
	public double f(double[] x) throws Exception {
		check(x);
		double prod1 = 1, prod2 = 1;
		for (int i = 0; i < x.length; i++) {
			prod1 *= Math.sin(x[i] -z );
		}
		for (int i = 0; i < x.length; i++) {
			prod2 *= Math.sin(B*(x[i] - z));
		}
		
		return -(A*prod1 + prod2);
	}

	@Override
	public String name() {
		return "SIN";
	}

	@Override
	public String description() {
		return "Sinusoidal Problem";
	}	
}
